package com.htfyun.factorytest.engineer_test;


import android.os.Handler;
import android.os.Message;

import java.lang.ref.WeakReference;

public class BaseActivityHandler extends Handler {

    private final WeakReference<BaseActivity> reference;

    public BaseActivityHandler(BaseActivity activity) {
        reference = new WeakReference<>(activity);
    }

    @Override
    public void handleMessage(Message msg) {
        BaseActivity activity = reference.get();
        if (activity == null) {
            return;
        }
        activity.handleMessage(msg);
    }
}
